package com.ms.game.rebate;

import com.ms.player.Player;
import com.ms.service.module.zone.command.BasicDebugCommand;
import com.ms.service.module.zone.message.CCashGoldTransactionDetailsRequest;
import com.xpec.c4.message.MessageTypes;
import com.xpec.c4.service.message.MessageAction;
import com.xpec.c4.service.module.ConsistentGroupName;

public class GetRebateCommand extends BasicDebugCommand{
	@Override
	public String execute() {
		if(commandValue.length < 2){
			return "command parameter error!";
		}
		int type = Integer.valueOf(commandValue[1]);
		int rebateType = 0;
		long time = 0l;
		
		Player player = getPlayer();
		String gameLobbyModule = ConsistentGroupName.lookUpGameLobbyModule(player.getGuid(), player.isRobot());

		switch(type){
		case 1:
			MessageAction.sendFakeClientMessage(player, gameLobbyModule, MessageTypes.C_CHECK_HAS_REBATE_REQUEST , "");
			break;
		case 2:
			//包月每日
			MessageAction.sendFakeClientMessage(player, gameLobbyModule, MessageTypes.C_GET_MONTHLY_DAILY_AWARD_REBATE_REQUEST , "");
			break;
		case 3: 
			if(commandValue.length < 3){
				return "command parameter error!";
			}
			
			time = Long.valueOf(commandValue[2]);
			//收到後將可領的回饋金 加到保險箱
			MessageAction.sendFakeClientMessage(player, gameLobbyModule, MessageTypes.C_GET_COMMISON_REBATE_REQUEST ,time);
			break;
		case 4:
			//一次全領
			MessageAction.sendFakeClientMessage(player, gameLobbyModule, MessageTypes.C_GET_ALL_REBATE_REQUEST ,"");
			break;
			
		case 5:
			if(commandValue.length < 3){
				return "command parameter error!";
			}
			
			String uplineId = commandValue[2];
			//收到後將可領的回饋金 加到保險箱
			MessageAction.sendFakeClientMessage(player, gameLobbyModule, MessageTypes.C_GET_UPLINE_INVITE_REWARD_REQUEST ,uplineId);
			break;
		
			
			
		
		case 10:
			long timeStart = Long.valueOf(commandValue[3]);
			long timeEnd = Long.valueOf(commandValue[2]);
			CCashGoldTransactionDetailsRequest request= new CCashGoldTransactionDetailsRequest();
			request.setStartTime(timeStart);
			request.setEndTime(timeEnd);
			MessageAction.sendFakeClientMessage(player, gameLobbyModule, MessageTypes.C_ZONE_CASH_GOLD_TRANSACTION_DETAIL_REQUEST, request);
		}
		
		
		return "ok";
	}

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return "rebate";
	}

	@Override
	public String getDescription() {
		// TODO Auto-generated method stub
		return "";
	}

	@Override
	public String getShortDescription() {
		// TODO Auto-generated method stub
		return "";
	}

}
